package cn.ahpu.tools;

import java.util.Random;

public class Rand {
	/**
	 * 随机生成一个0-100之间的数字
	 * @param args
	 * @return
	 */
	public static int rand_0_100(){
		Random r = new Random();
		int nextInt = r.nextInt(100);
		return nextInt;
	}
	
	/**
	 * 随机生成一个0-4之间的数字
	 * @param args
	 * @return
	 */
	public static int rand_0_4(){
		Random r = new Random();
		int nextInt = r.nextInt(4);
		return nextInt;
	}
	
	/**
	 * 随机生成一个5-12之间的数字
	 * @param args
	 * @return
	 */
	public static int rand_5_12(){
		Random r = new Random();
		int nextInt = 0;
		while(true) {
			nextInt = r.nextInt(12);
			if(nextInt>=5 && nextInt <12 && nextInt%2==1) {
					break;
			}
		}
		return nextInt;
	}
//	public static void main(String[] args) {
//		for (int i = 0; i < 12; i++) {
//			int a = Rand.rand_3_12();
//			System.out.println(a);
//		}
//	}
}
